package com.lxm.controller;

import com.lxm.entity.Emp;
import com.lxm.service.EmpService;
import com.lxm.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class EmpController {
    @Autowired
    private EmpService empService;

    @RequestMapping("/login.do")
    public String execute(String name,String password,Model model){
        Result result=empService.checkLogin(name,password);
        if(result.getStatus()==0){
            model.addAttribute("Msg",result.getMsg());
            return "error.jsp";
        }
        model.addAttribute("Emp",result.getData());
        model.addAttribute("Msg",result.getMsg());
        return "sucess.jsp";
    }

}
